@extends('admin.layout.layout')

@section('content')


    <div class="layui-form"  style="padding: 20px 0 0 0;">

        <div class="layui-form-item">
            <label class="layui-form-label">角色名称</label>
            <div class="layui-input-inline">
                <input class="layui-input" lay-verify="required|test"  type="text" name="name" placeholder="请输入角色名称" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="beizhu" placeholder="请输入备注" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">选择权限</label>
            <div class="layui-input-inline">
                <div id="LAY-auth-tree-index"></div>
            </div>
        </div>



        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-submit" id="LAY-submit" value="确认">
        </div>
    </div>

@endsection

@section('js')
    <script>

        lay.use(['jquery', 'authtree', 'form', 'layer'], function(){
            var $ = layui.jquery;
            var authtree = layui.authtree;
            $.getJSON( "{{url('admin/rbac/permission/lst')}}",function (res){
                authtree.render('#LAY-auth-tree-index', res.data.records, {
                    inputname: 'authids[]',
                    layfilter: 'lay-check-auth',
                    autowidth: true
                    ,childKey:'treeList'
                    ,primaryKey: 'id'
                    ,startPid: 0
                    ,parentKey: 'pid'
                    ,nameKey: 'name'
                    ,valueKey: 'id'
                    //,checkedKey:ids
                });
            });
        });

    </script>

@endsection

